home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C04 / CLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  692 b   |  24 lines

  1. //: C04:CLib.h
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Header file for a C-like library
  7. // An array-like entity created at runtime
  8.  
  9. typedef struct CStashTag {
  10.   int size;      // Size of each space
  11.   int quantity;  // Number of storage spaces
  12.   int next;      // Next empty space
  13.   // Dynamically allocated array of bytes:
  14.   unsigned char* storage;
  15. } CStash;
  16.  
  17. void initialize(CStash* s, int size);
  18. void cleanup(CStash* s);
  19. int add(CStash* s, const void* element);
  20. void* fetch(CStash* s, int index);
  21. int count(CStash* s);
  22. void inflate(CStash* s, int increase);
  23. ///:~
  24.